<?php
require_once('class/member.php');
  if(!isset($_SESSION['username'])){
    echo '</br><b><font color="black">Please Login to Comment :)</font></b></br></br>';
  }else{
  
  echo ' 
                    </br></br><form action="include/comment/comment.php" method="POST">
                    <label>Comment:  </label><br /><textarea name="comment" cols="66" rows="7" maxlength="60"></textarea><br /><br /><br />
                    <input type="submit" name="submit" value="Comment" /><br />                   
                    </form> </br>
                    <hr width="500px" size="5px" /></br>';
  }

?>

<?php
require('connect.php');
$query=mysql_query("SELECT * FROM comment ORDER BY id DESC");
while($rows=mysql_fetch_assoc($query))
{
     $id=$rows['id'];
     $dname=$rows['name'];
     $dcomment=$rows['comment'];
     if(!isset($_SESSION['username'])){
      $_SESSION['username']=NULL;  
     }
     
     if($_SESSION['username']=="carlos2891"){
     $linkdel="<a href=\"include/comment/delete.php?id=" . $rows['id'] . "\">delete</a>";
     }else{
        $linkdel="";
     }
     echo '<font color="red">Name:</font>  ' . $dname . '<br />' . '<br />' . '<font color="red">Comments:</font>  ' . '<br />' . $dcomment . '&nbsp' . '&nbsp' .
      '&nbsp' . '&nbsp' .  $linkdel . '<br />' . '<br />' . 
     '<hr size="5px" width="500px" color="blue" />'  ;
     
}
?>

